<?php



/**
 * This class defines the structure of the 'car_damages' table.
 *
 *
 *
 * This map class is used by Propel to do runtime db structure discovery.
 * For example, the createSelectSql() method checks the type of a given column used in an
 * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
 * (i.e. if it's a text column type).
 *
 * @package    propel.generator.damages.map
 */
class DamagesCarDamagesTableMap extends TableMap
{

    /**
     * The (dot-path) name of this class
     */
    const CLASS_NAME = 'damages.map.DamagesCarDamagesTableMap';

    /**
     * Initialize the table attributes, columns and validators
     * Relations are not initialized by this method since they are lazy loaded
     *
     * @return void
     * @throws PropelException
     */
    public function initialize()
    {
        // attributes
        $this->setName('car_damages');
        $this->setPhpName('CarDamages');
        $this->setClassname('DamagesCarDamages');
        $this->setPackage('damages');
        $this->setUseIdGenerator(true);
        // columns
        $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, 4, null);
        $this->addForeignKey('CAR_DATA_ID', 'CarDataId', 'INTEGER', 'car_data', 'ID', true, 4, null);
        $this->addForeignKey('STATUS_ID', 'StatusId', 'INTEGER', 'dict_statuses', 'ID', true, 4, null);
        $this->addForeignKey('DICT_PERPETRATOR_ID', 'DictPerpetratorId', 'INTEGER', 'dict_perpetrators', 'ID', true, 4, null);
        $this->addForeignKey('PROCESS_TYPE_ID', 'ProcessTypeId', 'INTEGER', 'process_types', 'ID', true, 4, null);
        $this->addForeignKey('RELATED_CAR_DAMAGE', 'RelatedCarDamage', 'INTEGER', 'car_damages', 'ID', false, 4, null);
        $this->addForeignKey('LS_ID', 'LsId', 'INTEGER', 'users', 'ID', false, 4, null);
        $this->addForeignKey('OL_ID', 'OlId', 'INTEGER', 'users', 'ID', false, 4, null);
        $this->addForeignKey('DISCARD_ID', 'DiscardId', 'INTEGER', 'dict_discards', 'ID', false, 4, null);
        $this->addColumn('DISCARD_DESCRIPTION', 'DiscardDescription', 'LONGVARCHAR', false, 2147483647, null);
        $this->addColumn('DAMAGE_DATE', 'DamageDate', 'TIMESTAMP', false, 16, null);
        $this->addColumn('DEALER_REPORT_DATE', 'DealerReportDate', 'TIMESTAMP', false, 16, null);
        $this->addColumn('PERPETRATOR_REPORT_DATE', 'PerpetratorReportDate', 'TIMESTAMP', false, 16, null);
        $this->addColumn('DAMAGES_DESCRIPTION', 'DamagesDescription', 'LONGVARCHAR', false, 2147483647, null);
        $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, 2147483647, null);
        $this->addColumn('CREATED', 'Created', 'TIMESTAMP', true, 16, null);
        $this->addColumn('MODIFIED', 'Modified', 'TIMESTAMP', false, 16, null);
        // validators
    } // initialize()

    /**
     * Build the RelationMap objects for this table relationships
     */
    public function buildRelations()
    {
        $this->addRelation('CarDamagesRelatedByRelatedCarDamage', 'DamagesCarDamages', RelationMap::MANY_TO_ONE, array('related_car_damage' => 'id', ), null, null);
        $this->addRelation('DictStatuses', 'DamagesDictStatuses', RelationMap::MANY_TO_ONE, array('status_id' => 'id', ), null, null);
        $this->addRelation('CarData', 'DamagesCarData', RelationMap::MANY_TO_ONE, array('car_data_id' => 'id', ), null, null);
        $this->addRelation('UsersRelatedByLsId', 'DamagesUsers', RelationMap::MANY_TO_ONE, array('ls_id' => 'id', ), null, null);
        $this->addRelation('UsersRelatedByOlId', 'DamagesUsers', RelationMap::MANY_TO_ONE, array('ol_id' => 'id', ), null, null);
        $this->addRelation('DictDiscards', 'DamagesDictDiscards', RelationMap::MANY_TO_ONE, array('discard_id' => 'id', ), null, null);
        $this->addRelation('DictPerpetrators', 'DamagesDictPerpetrators', RelationMap::MANY_TO_ONE, array('dict_perpetrator_id' => 'id', ), null, null);
        $this->addRelation('ProcessTypes', 'DamagesProcessTypes', RelationMap::MANY_TO_ONE, array('process_type_id' => 'id', ), null, null);
        $this->addRelation('Attachments', 'DamagesAttachments', RelationMap::ONE_TO_MANY, array('id' => 'car_damage_id', ), null, null, 'Attachmentss');
        $this->addRelation('CarDamageChangeLogs', 'DamagesCarDamageChangeLogs', RelationMap::ONE_TO_MANY, array('id' => 'car_damages_id', ), null, null, 'CarDamageChangeLogss');
        $this->addRelation('CarDamagesRelatedById', 'DamagesCarDamages', RelationMap::ONE_TO_MANY, array('id' => 'related_car_damage', ), null, null, 'CarDamagessRelatedById');
        $this->addRelation('Damages', 'DamagesDamages', RelationMap::ONE_TO_MANY, array('id' => 'car_damage_id', ), null, null, 'Damagess');
        $this->addRelation('EstimatedBudgets', 'DamagesEstimatedBudgets', RelationMap::ONE_TO_MANY, array('id' => 'car_damage_id', ), null, null, 'EstimatedBudgetss');
        $this->addRelation('Invoices', 'DamagesInvoices', RelationMap::ONE_TO_MANY, array('id' => 'car_damage_id', ), null, null, 'Invoicess');
        $this->addRelation('Notes', 'DamagesNotes', RelationMap::ONE_TO_MANY, array('id' => 'car_damage_id', ), null, null, 'Notess');
    } // buildRelations()

} // DamagesCarDamagesTableMap
